<?php
/**
 * Created by winleung
 * Date: 2018/11/28
 * Time: 11:48 AM
 */

namespace app\api\validate;

use think\Validate;

class Pharmacy extends Validate
{
    protected $rule = [
        'phone' => ['regex' => '^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$'],
        'pharmacy_name' => 'require',
        'pharmacy_tel_phone' => 'number',
        'password' => 'require',
        'description' => 'require',
        'longitude' => 'require|float',
        'latitude' => 'require|float',
        'address' => 'require',
        'avatar' => 'require',
        'check_status' => 'require|number|in:1,2,3',
        'pharmacy_id' => 'require|number',
    ];

    protected $message = [
        'phone.regex' => '请输入正确手机号',
        'pharmacy_name.require' => '请输入药店名称',
        'pharmacy_tel_phone.number' => '药店联系电话必须是数字',
        'password.require' => '请输入药店登陆密码',
        'description.require' => '请输入药店描述',
        'longitude.require' => '请提交店铺的经度',
        'longitude.float' => '店铺的经度格式不正确',
        'latitude.float' => '店铺的纬度格式不正确',
        'latitude.require' => '请提交店铺的纬度',
        'address.require' => '请提交店铺的地址',
        'avatar.require' => '请提交店铺的封面',
        'check_status.require' => '请输入审核状态',
        'check_status.number' => '审核状态必须是整形',
        'check_status.in' => '审核状态不存在',
        'pharmacy_id.require' => '请输入药店ID',
        'pharmacy_id.number' => '药店ID必须是整形',
    ];

    protected $scene = [
        'register' => ['pharmacy_name', 'phone', 'pharmacy_tel_phone', 'password', 'description', 'longitude', 'latitude', 'address', 'avatar'],
        'putUpdatePharmacyStatus' => ['pharmacy_id', 'check_status'],
        'getPharmacyInfo' => ['pharmacy_id'],
    ];


}